<!DOCTYPE html>
<html class="x-admin-sm" xmlns:th="http://www.thymeleaf.org">
    
    <head>
        <meta charset="UTF-8">
        <title>管理员编辑</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="format-detection" content="telephone=no">
        <link rel="stylesheet" th:href="@{/opsadmin/css/font.css}">
        <link rel="stylesheet" th:href="@{/opsadmin/css/index.css}">
        <script th:src="@{/opsadmin/lib/layui/layui.js}" charset="utf-8"></script>
        <script type="text/javascript" th:src="@{/opsadmin/js/index.js}"></script>
    </head>
    <body>
        <div class="layui-fluid">
            <div class="layui-row">

                <form action="/ops/user/update" method="post" enctype="multipart/form-data" class="layui-form">
                    <input th:value="${user.id}" name="id" type="hidden">

                    <div class="layui-form-item">
                        <label  class="layui-form-label"> <span class="x-red"></span>昵称 </label>
                        <div class="layui-input-inline">
                            <input th:value="${user.uname}" type="text"  name="uname" required autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label  class="layui-form-label"> <span class="x-red"></span>配图 </label>
                        <div class="layui-input-inline">
                            <img th:src="${user.img}" height="63" width="63">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label  class="layui-form-label"> <span class="x-red"></span>选择新头像 </label>
                        <div class="layui-input-inline">
                            <input name="img" type="text">div>
                    </div>


                    <div class="layui-form-item">
                        <label  class="layui-form-label"> <span class="x-red"></span>手机号 </label>
                        <div class="layui-input-inline">
                            <input th:value="${user.phone}" type="text" name="phone" required autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label  class="layui-form-label"> <span class="x-red"></span>密码 </label>
                        <div class="layui-input-inline">
                            <input th:value="${user.pwd}" type="text" name="pwd" required autocomplete="off" class="layui-input">
                        </div>
                    </div>



                    <div class="layui-form-item">
                        <label  class="layui-form-label"> <span class="x-red">*</span>邮箱 </label>
                        <div class="layui-input-inline">
                            <input th:value="${user.email}" class="layui-input" type="text" name="email">
                        </div>
                    </div>

                        <div class="layui-form-item">
                            <label  class="layui-form-label"> <span class="x-red">*</span>住址 </label>
                            <div class="layui-input-inline">
                                <input th:value="${user.address}" class="layui-input" type="text" name="address">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label  class="layui-form-label"> <span class="x-red">*</span>职业 </label>
                            <div class="layui-input-inline">
                                <input th:value="${user.profession}" class="layui-input" type="text" name="profession">
                            </div>
                        </div>

                    <div class="layui-form-item">
                        <label  class="layui-form-label"> </label>
                        <button  class="layui-btn" type="submit"> 确认</button>
                    </div>
                </form>

            </div>
        </div>
        <script>layui.use(['form', 'layer'],
            function() {
                $ = layui.jquery;
                var form = layui.form,
                layer = layui.layer;

                //自定义验证规则
                form.verify({
                    nikename: function(value) {
                        if (value.length < 5) {
                            return '昵称至少得5个字符啊';
                        }
                    },
                    pass: [/(.+){6,12}$/, '密码必须6到12位'],
                    repass: function(value) {
                        if ($('#L_pass').val() != $('#L_repass').val()) {
                            return '两次密码不一致';
                        }
                    }
                });

                //监听提交
                form.on('submit(add)',
                function(data) {
                    console.log(data);
                    //发异步，把数据提交给php
                    layer.alert("增加成功", {
                        icon: 6
                    },
                    function() {
                        //关闭当前frame
                        xadmin.close();

                        // 可以对父窗口进行刷新 
                        xadmin.father_reload();
                    });
                    return false;
                });

            });</script>
        <script>var _hmt = _hmt || []; (function() {
                var hm = document.createElement("script");
                hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
                var s = document.getElementsByTagName("script")[0];
                s.parentNode.insertBefore(hm, s);
            })();</script>
    </body>

</html>
